package de.seminar.lego3D;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;

import android.graphics.Color;

/**
 * Class that holds some static global variables.
 * 
 * @author Christian Lander
 *
 */
public class Constants {

	/** pattern that matches an usual IP address **/
	public static final Pattern pattern = Pattern
			.compile("[1-9][0-9][0-9]\\.[0-9][0-9][0-9]\\.([0-9]|[0-9][0-9]|[0-9][0-9][0-9])\\.([0-9]|[0-9][0-9]|[0-9][0-9][0-9])");

	/** the IP of the server, default set **/
	public static String HOST_IP = "192.168.2.100";

	/** String constants **/
	public static final String CUR_CHOICE = "curChoice";
	public static final String LEGO_WIDTH = "width";
	public static final String LEGO_HEIGHT = "height";
	public static final String LEGO_COLOR = "color";
	public static final String COLOR_HISTORY = "colorHistory";
	public static final String QR_CODE_RESULT = "qr_code_res";
	public static final String SUCCESSFUL = "successful";

	/**
	 * static map containing the default color set
	 */
	public static final Map<String, Integer> defaultColors = new HashMap<String, Integer>();
	static {
		defaultColors.put("0", Color.GRAY);
		defaultColors.put("1", Color.BLUE);
		defaultColors.put("2", Color.RED);
		defaultColors.put("3", Color.GREEN);
	}

	/**
	 * static array containing the colors
	 */
	public static ArrayList<Integer> colors;

	/**
	 * static array containing the image resource ids
	 */
	public static final Integer[] list_items = new Integer[] {
			R.drawable.lego_option, R.drawable.color_option,
			R.drawable.settings_option };

	/**
	 * static array with the text for the spinner items
	 */
	public static final String[] spinnerTags = new String[] { "QR scan",
			"Type in IP" };

	/**
	 * static array with the image for the spinner items
	 */
	public static final Integer[] spinner_imgs = new Integer[] {
			R.drawable.qr_icon, R.drawable.input_icon };

	/**
	 * the current color, default set to grey
	 */
	public static int CURRENT_COLOR = Color.LTGRAY;

	/**
	 * the current lego brick
	 */
	public static Legobrick CURRENT_LEGO = null;

	/**
	 * index of the current shown fragment
	 */
	public static int CUR_FRAG = 0;

	/**
	 * flag, that states wehter the settings view was already presented to the
	 * user (helps to decide if the start animation should be shown)
	 */
	public static boolean settingsViewAlreadySeen = false;
}
